package com.book.manager.service;

import com.book.manager.dao.SupplierDAO;
import com.book.manager.pojo.Supplier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SupplierService {
    @Autowired
    private SupplierDAO supplierDAO;
    public List<Supplier> list() {
        List<Supplier> all = supplierDAO.findAll();
        return all;
    }

    public boolean addOrUpdate(Supplier supplier) {
        supplierDAO.save(supplier);
        return true;
    }

    public void deleteById(int id) {
        supplierDAO.deleteById(id);
    }
}
